﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Showme.Controllers;

namespace Showme
{
    public partial class CustomerMain : Form
    {
        public CustomerMain()
        {
            InitializeComponent();
        }

        private void CustomerMain_Load(object sender, EventArgs e)
        {

        }

        private void CustomerMain_Load_1(object sender, EventArgs e)
        {
            dataGridView1.DataSource = ShowmeController.Instance.GetMedia();
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.Columns[1].Visible = false;
            dataGridView1.MultiSelect = false;
            dataGridView1.SelectionChanged += dataGridView1_SelectionChanged;
            lblUser.Text = ShowmeController.Instance.currentUser.username;
        }

        void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                var link = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
                
                player.Movie = link;
            }catch(Exception ex){}
        }
    }
}
